import Foundation

protocol MPConvertibleDate {}
extension NSDate: MPConvertibleDate {}
extension Date: MPConvertibleDate {}

func mp_date(_ value: Any) -> MPConvertibleDate? {
    if let v = value as? Date { return v }
    guard let time = Double("\(value)") else { return nil }
    return Date(timeIntervalSince1970: time)
}
